package com.gopay.common.domain.ptbank;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;

/**
 * Entity: 标的放款明细文件
 */
@Entity
@Table(name = "GSRT_BANK_HF_TD_ACCT_DTL")
public class GsrtBankHfTdAcctDtl implements java.io.Serializable {
	
	/**
     * 
     * @Description 上传文本数据项坐标
     * @author zyt
     * @date 2016年05月03日
     *
     */
    public enum UploadCoordinate {
    	PROID(0, "proid", "标的号"), 
    	TRANSDT(1, "transdt", "交易日期"),
    	TRANSTYPE(2, "transtype", "交易类型"), 
    	NAME(3, "name", "投资人姓名"),
    	CERTTYPE(4, "certtype", "投资人证件类型"), 
        CREDITACCTNO(5, "certnumber", "投资人证件号码"),
        PROSTAT(6, "borrcustid", "借款人ID"), 
        BORRNAME(7, "borrname", "借款人姓名"),
        BORRCERTTYPE(8, "borrcerttype", "借款人证件类型"), 
        BORRCERTID(9, "borrcertid", "借款人证件号码"),
        CREDITMONEY(10, "creditmoney", "该笔放款金额 "), 
        REPAYPRCP(11, "repayprcp", "该笔还款本金"),
        REPAYINTST(12, "repayintst", "该笔还款利息");
    	
        private int coordinate;
        private String field;
        private String comments;

        private UploadCoordinate(int coordinate, String field, String comments) {
            this.coordinate = coordinate;
            this.field = field;
            this.comments = comments;
        }

        public static Map<Integer, String> getTextCoordinate() {
            Map<Integer, String> map = new HashMap<>();
            for (UploadCoordinate uploadCoordinate : UploadCoordinate.values()) {
                map.put(uploadCoordinate.getCoordinate(), uploadCoordinate.getField());
            }
            return map;
        }
        
        public static Map<Integer, String> getCommentsCoordinate() {
            Map<Integer, String> map = new HashMap<>();
            for (UploadCoordinate uploadCoordinate : UploadCoordinate.values()) {
                map.put(uploadCoordinate.getCoordinate(), uploadCoordinate.getComments());
            }
            return map;
        }
        
        public static String getCommentsByCoordinate(int coordinate) {
            for (UploadCoordinate uploadCoordinate : UploadCoordinate.values()) {
                if (uploadCoordinate.getCoordinate() == coordinate) {
                    return uploadCoordinate.comments;
                }
            }
            return null;
        }

        public int getCoordinate() {
            return coordinate;
        }

        public void setCoordinate(int coordinate) {
            this.coordinate = coordinate;
        }

        public String getField() {
            return field;
        }

        public void setField(String field) {
            this.field = field;
        }

        public String getComments() {
            return comments;
        }

        public void setComments(String comments) {
            this.comments = comments;
        }

    }
    
    /**
     * 
     * @Description 下载文本数据项坐标
     * @author zyt
     * @date 2016年05月03日
     *
     */
    public enum DownloadCoordinate {
    	PROID(0, "proid", "标的号"), 
    	TRANSDT(1, "transdt", "交易日期"),
    	TRANSTYPE(2, "transtype", "交易类型"), 
    	//NAME(3, "name", "投资人姓名"),
    	CERTTYPE(4, "certtype", "投资人证件类型"), 
        CREDITACCTNO(5, "certnumber", "投资人证件号码"),
        PROSTAT(6, "borrcustid", "借款人ID"), 
        //BORRNAME(7, "borrname", "借款人姓名"),
        BORRCERTTYPE(8, "borrcerttype", "借款人证件类型"), 
        BORRCERTID(9, "borrcertid", "借款人证件号码"),
        CREDITMONEY(10, "creditmoney", "该笔放款金额 ");
        /*REPAYPRCP(11, "repayprcp", "该笔还款本金"),
        REPAYINTST(12, "repayintst", "该笔还款利息");*/
    	
        private int coordinate;
        private String field;
        private String comments;

        private DownloadCoordinate(int coordinate, String field, String comments) {
            this.coordinate = coordinate;
            this.field = field;
            this.comments = comments;
        }

        public static Map<Integer, String> getTextCoordinate() {
            Map<Integer, String> map = new HashMap<>();
            for (DownloadCoordinate downloadCoordinate : DownloadCoordinate.values()) {
                map.put(downloadCoordinate.getCoordinate(), downloadCoordinate.getField());
            }
            return map;
        }
        
        public static Map<Integer, String> getCommentsCoordinate() {
            Map<Integer, String> map = new HashMap<>();
            for (DownloadCoordinate downloadCoordinate : DownloadCoordinate.values()) {
                map.put(downloadCoordinate.getCoordinate(), downloadCoordinate.getComments());
            }
            return map;
        }
        
        public static String getCommentsByCoordinate(int coordinate) {
            for (DownloadCoordinate downloadCoordinate : DownloadCoordinate.values()) {
                if (downloadCoordinate.getCoordinate() == coordinate) {
                    return downloadCoordinate.comments;
                }
            }
            return null;
        }

        public int getCoordinate() {
            return coordinate;
        }

        public void setCoordinate(int coordinate) {
            this.coordinate = coordinate;
        }

        public String getField() {
            return field;
        }

        public void setField(String field) {
            this.field = field;
        }

        public String getComments() {
            return comments;
        }

        public void setComments(String comments) {
            this.comments = comments;
        }

    }

	private static final long serialVersionUID = 1L;

	/** 
	 * 编号
	 */
	private String dtlId;

	/** 
	 * 乐观锁版本号
	 */
	private Long version;

	/** 
	 * 客户id
	 */
	private String custid;

	/** 
	 * 支付机构平台ID
	 */
	private String mercustid;

	/** 
	 * 标的号
	 */
	private String proid;

	/** 
	 * 交易日期
	 */
	private String transdt;

	/** 
	 * 交易类型
	 */
	private String transtype;

	/** 
	 * 投资人姓名
	 */
	private String name;

	/** 
	 * 投资人证件类型
	 */
	private String certtype;

	/** 
	 * 投资人证件号码
	 */
	private String certnumber;

	/** 
	 * 借款人ID
	 */
	private String borrcustid;

	/** 
	 * 该笔放款金额
	 */
	private BigDecimal creditmoney;

	/** 
	 * 该笔还款本金
	 */
	private BigDecimal repayprcp;

	/** 
	 * 该笔还款利息
	 */
	private BigDecimal repayintst;

	private String resv1;

	private String resv2;

	private String resv3;

	private String resv4;

	/** 
	 * 国付宝交易时间
	 */
	private String gopayTxnTm;

	/**
	 * 借款人姓名
	 */
	private String borrname;

	/**
	 * 借款人证件号码
	 */
	private String borrcertid;

	/**
	 * 借款人证件类型
	 */
	private String borrcerttype;

	/** 
	 * 发送银行状态
	已发送：01；
	未发送：02   ；
	发送失败：03 ；
	发送中：04
	 */
	private String bankstate;

	private String commentRk;

	/** 
	 * 创建时间
	 */
	private Date createdTs;

	/** 
	 * 记录最后修改时间
	 */
	private Date lastUpdTs;

	private String remark;

	private String remark2;

	private String remark3;

	public GsrtBankHfTdAcctDtl() {
	}

	public GsrtBankHfTdAcctDtl(String dtlId, Long version, String custid, String mercustid, String proid,
							   String transdt, String transtype, String name, String certtype, String certnumber,
							   String borrcustid, BigDecimal creditmoney, BigDecimal repayprcp, BigDecimal repayintst,
							   String resv1, String resv2, String resv3, String resv4, String gopayTxnTm,
							   String borrname, String borrcertid, String borrcerttype, String bankstate,
							   String commentRk, Date createdTs, Date lastUpdTs, String remark, String remark2,
							   String remark3) {
		this.dtlId = dtlId;
		this.version = version;
		this.custid = custid;
		this.mercustid = mercustid;
		this.proid = proid;
		this.transdt = transdt;
		this.transtype = transtype;
		this.name = name;
		this.certtype = certtype;
		this.certnumber = certnumber;
		this.borrcustid = borrcustid;
		this.creditmoney = creditmoney;
		this.repayprcp = repayprcp;
		this.repayintst = repayintst;
		this.resv1 = resv1;
		this.resv2 = resv2;
		this.resv3 = resv3;
		this.resv4 = resv4;
		this.gopayTxnTm = gopayTxnTm;
		this.borrname = borrname;
		this.borrcertid = borrcertid;
		this.borrcerttype = borrcerttype;
		this.bankstate = bankstate;
		this.commentRk = commentRk;
		this.createdTs = createdTs;
		this.lastUpdTs = lastUpdTs;
		this.remark = remark;
		this.remark2 = remark2;
		this.remark3 = remark3;
	}

	@Id
	@SequenceGenerator(name = "GsrtBankHfTdAcctDtlSequence", sequenceName = "GSRT_BANK_HF_TD_ACCT_DTL_SEQ")
	@GeneratedValue(generator = "GsrtBankHfTdAcctDtlSequence", strategy = GenerationType.SEQUENCE)
	@Column(name = "DTL_ID", unique = true, nullable = false, length = 32)
	public String getDtlId() {
		return this.dtlId;
	}

	public void setDtlId(String dtlId) {
		this.dtlId = dtlId;
	}

	@Version
	@Column(name = "VERSION", precision = 22, scale = 0)
	public Long getVersion() {
		return this.version;
	}

	public void setVersion(Long version) {
		this.version = version;
	}

	@Column(name = "CUSTID", length = 10)
	public String getCustid() {
		return this.custid;
	}

	public void setCustid(String custid) {
		this.custid = custid;
	}

	@Column(name = "MERCUSTID", nullable = false, length = 20)
	public String getMercustid() {
		return this.mercustid;
	}

	public void setMercustid(String mercustid) {
		this.mercustid = mercustid;
	}

	@Column(name = "PROID", nullable = false, length = 32)
	public String getProid() {
		return this.proid;
	}

	public void setProid(String proid) {
		this.proid = proid;
	}

	@Column(name = "TRANSDT", nullable = false, length = 8)
	public String getTransdt() {
		return this.transdt;
	}

	public void setTransdt(String transdt) {
		this.transdt = transdt;
	}

	@Column(name = "TRANSTYPE", length = 10)
	public String getTranstype() {
		return this.transtype;
	}

	public void setTranstype(String transtype) {
		this.transtype = transtype;
	}

	@Column(name = "NAME", length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "CERTTYPE", length = 10)
	public String getCerttype() {
		return this.certtype;
	}

	public void setCerttype(String certtype) {
		this.certtype = certtype;
	}

	@Column(name = "CERTNUMBER", length = 30)
	public String getCertnumber() {
		return this.certnumber;
	}

	public void setCertnumber(String certnumber) {
		this.certnumber = certnumber;
	}

	@Column(name = "BORRCUSTID", length = 20)
	public String getBorrcustid() {
		return this.borrcustid;
	}

	public void setBorrcustid(String borrcustid) {
		this.borrcustid = borrcustid;
	}

	@Column(name = "CREDITMONEY", precision = 16)
	public BigDecimal getCreditmoney() {
		return this.creditmoney;
	}

	public void setCreditmoney(BigDecimal creditmoney) {
		this.creditmoney = creditmoney;
	}

	@Column(name = "REPAYPRCP", precision = 16)
	public BigDecimal getRepayprcp() {
		return this.repayprcp;
	}

	public void setRepayprcp(BigDecimal repayprcp) {
		this.repayprcp = repayprcp;
	}

	@Column(name = "REPAYINTST", precision = 16)
	public BigDecimal getRepayintst() {
		return this.repayintst;
	}

	public void setRepayintst(BigDecimal repayintst) {
		this.repayintst = repayintst;
	}

	@Column(name = "RESV1", length = 30)
	public String getResv1() {
		return this.resv1;
	}

	public void setResv1(String resv1) {
		this.resv1 = resv1;
	}

	@Column(name = "RESV2", length = 30)
	public String getResv2() {
		return this.resv2;
	}

	public void setResv2(String resv2) {
		this.resv2 = resv2;
	}

	@Column(name = "RESV3", length = 60)
	public String getResv3() {
		return this.resv3;
	}

	public void setResv3(String resv3) {
		this.resv3 = resv3;
	}

	@Column(name = "RESV4", length = 60)
	public String getResv4() {
		return this.resv4;
	}

	public void setResv4(String resv4) {
		this.resv4 = resv4;
	}

	@Column(name = "GOPAY_TXN_TM", length = 8)
	public String getGopayTxnTm() {
		return this.gopayTxnTm;
	}

	public void setGopayTxnTm(String gopayTxnTm) {
		this.gopayTxnTm = gopayTxnTm;
	}

	@Column(name = "BORRNAME", length = 150)
	public String getBorrname() {
		return this.borrname;
	}

	public void setBorrname(String borrname) {
		this.borrname = borrname;
	}

	@Column(name = "BORRCERTID", length = 20)
	public String getBorrcertid() {
		return this.borrcertid;
	}

	public void setBorrcertid(String borrcertid) {
		this.borrcertid = borrcertid;
	}

	@Column(name = "BORRCERTTYPE", length = 10)
	public String getBorrcerttype() {
		return this.borrcerttype;
	}

	public void setBorrcerttype(String borrcerttype) {
		this.borrcerttype = borrcerttype;
	}

	@Column(name = "BANKSTATE", length = 2)
	public String getBankstate() {
		return this.bankstate;
	}

	public void setBankstate(String bankstate) {
		this.bankstate = bankstate;
	}

	@Column(name = "COMMENT_RK", length = 50)
	public String getCommentRk() {
		return this.commentRk;
	}

	public void setCommentRk(String commentRk) {
		this.commentRk = commentRk;
	}

	@Column(name = "CREATED_TS", nullable = false)
	public Date getCreatedTs() {
		return this.createdTs;
	}

	public void setCreatedTs(Date createdTs) {
		this.createdTs = createdTs;
	}

	@Column(name = "LAST_UPD_TS", nullable = false)
	public Date getLastUpdTs() {
		return this.lastUpdTs;
	}

	public void setLastUpdTs(Date lastUpdTs) {
		this.lastUpdTs = lastUpdTs;
	}

	@Column(name = "REMARK", length = 50)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "REMARK2", length = 50)
	public String getRemark2() {
		return this.remark2;
	}

	public void setRemark2(String remark2) {
		this.remark2 = remark2;
	}

	@Column(name = "REMARK3", length = 50)
	public String getRemark3() {
		return this.remark3;
	}

	public void setRemark3(String remark3) {
		this.remark3 = remark3;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE);
	}
}
